// 1. 给对象添加类型
interface Person {
  name: string
  age: number
  isSinger: boolean
}

const p1: Person = {
  name: '张三',
  age: 18,
  isSinger: false,
}

const p2: Person = {
  name: '李四',
  age: 28,
  isSinger: true,
}

// 2. 给接口返回数据做类型
interface Notice {
  id: string
  title: string
  content: string
  createdAt: string
  creatorName: string
  testTitle?: string
}

interface Response {
  code: number
  message: string
  data: Notice
}

const res: Response = {
  code: 10000,
  message: '获取数据成功',
  data: {
    id: '1001',
    title: '通知: 明天正常上课',
    content: '好好上课, 薪资过万',
    createdAt: '2025-2-10',
    creatorName: '管理员',
  },
}

// res.data.createdAt

export { p1, p2, res }
